<!--车辆处置页面-->
<template>
  <div>
    <el-dialog title="详情" :visible.sync="dialogVisible" width="80%" v-if="formData" @close="close">
      <el-form :model="formData" label-width="150px" ref="form">
        <el-row>
          <el-col :sm="12">
            <el-form-item label="申请人单位">{{formData.companyName}}</el-form-item>
          </el-col>
          <el-col :sm="12">
            <el-form-item label="申请车辆">{{formData.car.carCode}}</el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="formData.liters">
          <el-col :sm="12">
            <el-form-item label="加油量(L)">{{formData.liters}}</el-form-item>
          </el-col>
          <el-col :sm="12">
            <el-form-item label="加油金额">{{formData.price}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :sm="24">
            <el-form-item label="历史流程"></el-form-item>
          </el-col>
        </el-row>
        <el-timeline :reverse="true" class>
          <el-timeline-item
            v-for="(activity, index) in history"
            :key="index"
            :timestamp="activity.optime"
          >
            {{activity.taskName}}。操作人：
            {{activity.userName}}，
            备注：
            {{activity.mark||' - '}}。
            <template>
              <span v-if="activity.passStr">--------- {{activity.passStr}}</span>
            </template>
          </el-timeline-item>
        </el-timeline>
      </el-form>
      <span slot="footer" class="dialog-footer" style="text-align: left;">
        <el-button @click="close">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { viewJson } from "@/api/task";
import { dateFormat } from "@/utils/utils";
export default {
  data() {
    return {
      pass: 1,
      opData: null,
      history: [],
      formData: null,
      dialogVisible: false
    };
  },
  created() {
    this.webUploadUrl = this.VUE_APP_BASE_API + "/common/webupload.shtml";
  },
  methods: {
    close() {
      this.dialogVisible = false;
    },
    /**
     * @description 查看任务
     * @param opData 当前操作的任务原始数据 list接口返回的
     */
    async viewTask(opData) {
      this.opData = opData;
      let params = {
        tableId: opData.id,
        pid: opData.prcid,
        // taskId: opData.taskId,
        formKey: "carju_wcju"
      };
      let taskDetail = await viewJson(params);
      this.formData = taskDetail.data;
      this.history.splice(0, this.history.length, ...taskDetail.history);
      this.dialogVisible = true;
    }
  }
};
</script>
<style lang="scss" scoped>
.el-timeline {
  position: relative;
  top: -25px;
  left: 110px;
  margin-bottom: -45px;
}
</style>
<style lang="scss">
.upload-mini {
  .el-upload-dragger {
    height: 50px;
    line-height: 50px;
  }
}

.upload-mini + .el-form-item__error {
  position: relative;
  top: -15px;
}
</style>
<style lang="scss" scoped>
.el-timeline {
  position: relative;
  top: -45px;
  left: 110px;
  margin-bottom: -45px;
}
</style>